node {
    gid = sh (script: "stat -c %g /run/containerd/containerd.sock", returnStdout: true,).trim()
    docker.withRegistry('https://im30cr.tencentcloudcr.com', 'im30cr') {

        stage('Preparation') {
            checkout scm
        }

        stage('Build') {
            imageName = "im30cr.tencentcloudcr.com/im30/java-nodejs-build:v${env.BUILD_NUMBER}"
            try {
                image = docker.build(imageName, "--force-rm -f dockerfiles/Dockerfile-All-In-One-Build ./dockerfiles/")
                image.push()
            } catch (err) {
                echo err.getMessage()
            }
            sh "docker rmi ${imageName}"
        }
    }
}